const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');

const OrderInfo = sequelize.define('order_info', {
  order_id: {
    type: DataTypes.STRING(32),
    allowNull: false,
    primaryKey: true,
    comment: '订单编号'
  },
  order_status: {
    type: DataTypes.ENUM('待付款', '已付款', '已发货', '已签收', '已取消'),
    allowNull: false,
    defaultValue: '待付款',
    comment: '订单状态'
  },
  order_details: {
    type: DataTypes.JSON,
    allowNull: false,
    comment: '订单详情'
  },
  payment_status: {
    type: DataTypes.ENUM('未支付', '已支付', '已退款'),
    allowNull: false,
    defaultValue: '未支付',
    comment: '付款状态'
  },
  merchant_name: {
    type: DataTypes.STRING(10),
    allowNull: false,
    comment: '商家名称'
  },
  merchant_taobao_id: {
    type: DataTypes.CHAR(9),
    allowNull: false,
    comment: '商家淘宝ID'
  },
  manager_id: {
    type: DataTypes.STRING(32),
    allowNull: false,
    comment: '负责人编号'
  }
}, {
  tableName: 'order_info',
  timestamps: true,
  createdAt: 'create_time',
  updatedAt: 'update_time'
});

module.exports = OrderInfo; 